extends ./layout.pug
include _tableMixins

block content
  include runInfo

  if usingBrowsertime
    h2 Runtime settings
    table
      tr 
        td Sitespeed.io version
        td #{version}
      tr 
        td Browsertime version
        td #{browsertimeVersion}
      tr 
        td Test time
        td #{timestamp}
      tr
        td Browser 
        td #{h.cap(get(browser, 'name'))} #{get(browser, 'version', 'unknown')}
      tr 
        td User Agent
        td #{get(browser, 'userAgent')}
      if options.mobile
        tr 
          td Emulated mobile
          td Yes
      if hostname
         tr
          td Hostname
          td #{hostname}
      if cpuBenchmark
        tr
          td CPU benchmark
          td #{cpuBenchmark} (first run)
      if options.replay || options.webpagereplay
        tr
          td Using WebPageReplay 
          td Yes
      if options.multi
        tr
          td Using multi mode
          td Yes
      if options.preURL 
        tr 
          td Using preURL 
          td #{h.short(options.preURL, 60)}     
      if !options.mobile && !ios && !android
        tr
          td View port
          td #{options.viewPort}
      else
        tr
          td Window size
          td #{windowSize}
      tr 
        td Connectivity
        td #{ get(connectivity, 'profile') === 'native' ? 'No connectivity settings' : ` ${get(connectivity, 'profile')} using ${get(connectivity, 'engine')} (Down: ${get(connectivity, 'settings.down', '')} Up: ${get(connectivity, 'settings.up', '')} RTT: ${get(connectivity, 'settings.rtt', '')})`}
      tr 
        td Number of runs
        td #{get(options, 'browsertime.iterations')}
      if get(browser, 'traceCategories') !== undefined
        tr
          td Trace categories
          td #{get(browser, 'traceCategories')}
      if get(options, 'browsertime.enableProfileRun') !== undefined
        tr 
          td Enabled profile run
          td Yes
      if get(browser, 'preference') !== undefined
        tr
          td browser.preference
          td #{get(browser, 'preference')}
      if get(browser, 'args') !== undefined
        tr
          td browser.args
          td #{get(browser, 'args')}
      if get(browser, 'geckoProfilerFeatures') !== undefined
        tr
          td Gecko Profiler Features
          td #{get(browser, 'geckoProfilerFeatures')}
      tr 
        td OS
        td #{android ? 'Android' : (ios ? 'iOS' :  (options.browsertime.docker ? 'Docker using ' + os: os)) }
      if android
        if android.model
          tr 
            td Phone model
            td #{android.model}
        if android.id
          tr
            td Id
            td #{android.id}
        if android.androidVersion
          tr 
            td Android version
            td #{android.androidVersion}
        if android.wifi
          tr 
            td Wifi
            td #{android.wifi}
        tr
          td Using gnirehtet
          td #{get(options, 'browsertime.android.gnirehtet', 'No')}
        tr
          td Rooted phone
          td #{get(options, 'browsertime.android.rooted', 'No')}
        if android.batteryTemperature
          tr 
            td Battery temperature
            td Start: #{android.batteryTemperature.start} °C Stop: #{android.batteryTemperature.stop} °C
      if ios
        if ios.deviceName
          tr 
            td Device
            td #{ios.deviceName}
        if ios.deviceUDID
          tr 
            td UUID
            td #{ios.deviceUDID}
  else 
    p No runtime settings if you do not run Browsertime.
